﻿using MediatR;
using RedDragon.Common.Domain.produceplan;
using RedDragon.Common.Infrastructure.Interface;
using T.Common.Domain.Common;

namespace RedDragon.RBAC.API.Application.Common.produceplanW
{
    public class ProduceplanFullHandler : IRequestHandler<ProduceplanFullCommon, Result>
    {
        public readonly IBaseRepository<produceplan> produceplanRepository;

        public ProduceplanFullHandler(IBaseRepository<produceplan> produceplanRepository)
        {
            this.produceplanRepository = produceplanRepository;
        }

        public async Task<Result> Handle(ProduceplanFullCommon request, CancellationToken cancellationToken)
        {
            var result = new Result() { Code = 0, Msg = "" };
            try
            {
               var list =   produceplanRepository.Query().Where(x=>x.produceplanId==request.ProduceplanId);
                result.Data = list;
              
            }
            catch (Exception)
            {

                throw;
            }
            return result;
        }
    }
}
